package com.zxl.designpattern.structure.facade;

/**
 * @author zxl
 * @version 1.0
 * @description 游戏启动器（门面）
 * @date 2025/6/1 14:22
 */
public class GameLauncherFacade {
    private GameClient gameClient;
    private AntiCheatSystem antiCheat;
    private TradingSystem voiceChat;

    public GameLauncherFacade(GameClient gameClient, AntiCheatSystem antiCheat, TradingSystem voiceChat) {
        this.gameClient = gameClient;
        this.antiCheat = antiCheat;
        this.voiceChat = voiceChat;
    }

    // 一键启动游戏
    public void startGame() {
        System.out.println("游戏启动器准备中...");
        
        gameClient.initialize();
        antiCheat.initialize();
        voiceChat.initialize();
        
        gameClient.verifyGameFiles();
        antiCheat.scanSystem();
        
        gameClient.loadAssets();
        voiceChat.connectToServer();
        
        antiCheat.startMonitoring();
        voiceChat.joinChannel();
        
        gameClient.startGameSession();
        System.out.println("游戏已启动！享受游戏吧！");
    }

    // 一键退出游戏
    public void quitGame() {
        System.out.println("正在关闭游戏...");
        
        gameClient.closeGameSession();
        antiCheat.stopMonitoring();
        voiceChat.disconnect();
        
        System.out.println("游戏已完全关闭，感谢游玩！");
    }
}    